function delta_x = calculate_error(DH_para, delta_para, x_real, Q)
[n, ~] = size(Q);

px = delta_para(1); py = delta_para(2); pz = delta_para(3);
rz = delta_para(4); ry = delta_para(5); rx = delta_para(6);
tx = delta_para(7); ty = delta_para(8); tz = delta_para(9);

T_b0 = Translx(px) * Transly(py) * Translz(pz) * Trotz(rz) * Troty(ry) * Trotx(rx);
T_tool = Transl(tx, ty, tz);

for i = 1:n
    qi = Q(i, :);
    T_th = T_b0 * fkine(DH_para, qi) * T_tool;
    x_th(3*i-2: 3*i, :) = T_th(1:3, 4);
end

delta_x = x_real - x_th;